<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>货品信息列表</title>
<link href="<%=path%>/css/core.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/pagination.css" rel="stylesheet"
	type="text/css" />
<link href="<%=path%>/css/list.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/xToolbar.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/jquery-impromptu.css" rel="stylesheet"
	type="text/css" />
</head>
<body>
	<div id="toolbar"></div>
	<form id="listForm"
		action="<%=path%>/product/product/listPagination.t4m" method="post">
		<table id="titleTable" cellpadding="0" cellspacing="0">
			<tr>
				<td>&nbsp;</td>
				<td><input type="checkbox" id="allBox" />
				</td>
				<td>货品编号</td>
				<td>货品名称</td>
				<td>规格型号</td>
				<td>品牌名称</td>
				<td>生产商</td>
				<td>备注</td>
				<td>创建人</td>
				<td>创建时间</td>
			</tr>
		</table>
		<table id="dataTable" cellpadding="0" cellspacing="0">
			<s:iterator id="product" value="page.list" status="i">
				<tr class="row">
					<td class="num"><s:property value="#i.index+1" />
					</td>
					<td class="box"><input type="checkbox" name="idList"
						value="<s:property value="#product.id"/>" /></td>
					<td><span><s:property value="#product.code" />&nbsp;</span>
					</td>
					<td align="center"><span><s:property
								value="#product.name" />&nbsp;</span>
					</td>
					<td><span><s:property value="#product.standard" />&nbsp;</span>
					</td>
					<td><span><s:property value="#product.brand" />&nbsp;</span>
					</td>
					<td><span><s:property value="#product.manufacturer" />&nbsp;</span>
					</td>
					<td align="center"><span><s:property
								value="#product.remark" />&nbsp;</span>
					</td>
					<td align="center"><span><s:property
								value="#product.creator.realName" />&nbsp;</span>
					</td>
					<td align="center"><span><s:date
								name="#product.createTime" format="yyyy-MM-dd HH:mm" />&nbsp;</span>
					</td>
				</tr>
			</s:iterator>
		</table>
      <s:hidden name="productTypeId" id="productTypeId"/>
		<s:hidden name="productId" />
		<s:include value="/share/pagebar.jsp" />
	</form>

	<script src="<%=path%>/js/core.js" type="text/javascript"></script>
	<script src="<%=path%>/js/share.js" type="text/javascript"></script>
	<script src="<%=path%>/js/jquery.js" type="text/javascript"></script>
	<script src="<%=path%>/js/Grid.js" type="text/javascript"></script>
	<script src="<%=path%>/js/BoxSelect.js" type="text/javascript"></script>
	<script src="<%=path%>/js/xToolbar.js" type="text/javascript"></script>
	<script src="<%=path%>/js/xToolbar.items.js" type="text/javascript"></script>
	<script src="<%=path%>/js/jquery-impromptu.js" type="text/javascript"></script>
	<script type="text/javascript">
	$(document).ready(function(){
	      new Toolbar({
	        id: '1',
	        renderTo : 'toolbar',
	        icon: '../../image/op.gif',
	        items : [{
	          type:'button',
	          text:'新建',
	          useable : '<s:property value="@org.team4.util.Meta@getOperate(\"product_new\")"/>',
	          position: {
	            a: '0px 0px',
	            b: '0px -120px'
	          },
	          handler:function(){
	            top.productFunctions.openSaveProductWindow($('#productTypeId').val());
	          }
	        },'-',{
	          type : 'button',
	          text : '修改',
	          useable : '<s:property value="@org.team4.util.Meta@getOperate(\"product_edit\")"/>',
	          position: {
	            a: '-20px 0px',
	            b: '-20px -120px'
	          },
	          handler : function(){
	            if(getFirstID()) {
	              top.productFunctions.openUpdateProductWindow(getFirstID());
	            }
	          }
	        },'-',{
		          type : 'button',
		          text : '查看',
		          useable : '<s:property value="@org.team4.util.Meta@getOperate(\"product_view\")"/>',
		          position: {
		                a: '-180px -60px',
		                b: '-180px -180px'
		          },
		          handler : function(){
		            if(getFirstID()) {
		              top.productFunctions.openViewProductWindow(getFirstID());
		            }
		          }
		        },'-',{
	          type : 'button',
	          text : '删除',
	          position: {
	            a: '-40px 0px',
	            b: '-40px -120px'
	          },
	          useable : '<s:property value="@org.team4.util.Meta@getOperate(\"product_delete\")"/>',
	          handler : function(){
	        	  if(getFirstID())
	              {
	                var txt = '是否删除该信息？';
	                $.prompt(txt,{
	                  buttons:{删除:true,取消:false},
	                  callback: function(v,m) {
	                    if(v) {
	                      document.getElementById('listForm').action = '<%=path%>/product/product/delete.t4m';
	                      document.getElementById('listForm').submit();
	                    }
	                  }
	                });
	              }
	          }
	        }]
	      });
	      
	      new Grid({
	        titleTable:'titleTable',
	        dataTable:'dataTable',
	        widths : [30,24,140,140,120,120,120,120,100,130],
	        height : function(){return getGridHeight({toolbarId:'toolbar',hasPage:true});}
	      });
	      
	      new BoxSelect({
	        allId : 'allBox',
	        boxName : 'idList'
	      });
	      
	      loadReady();
	    });
    </script>
</body>
</html>